﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using WinFormAssigment.Entities;

namespace WinFormAssigment.DAO
{
    class Query
    {
        public static string username = "@username";
        public static string password = "@password";
        public static string teacherLogin = "sp_GetTeacherLogin";
        public static SqlParameter[] TeacherLogin(string user, string pass)
        {
            SqlParameter[] arr = { new SqlParameter(username, user), new SqlParameter(password, pass) };
            return arr;
        }

        public static string managerLogin = "sp_GetManagerLogin";
        public static SqlParameter[] ManagerLogin(string user, string pwd)
        {
            SqlParameter[] arr = { new SqlParameter(username, user), new SqlParameter(password, pwd), };
            return arr;
        }

        // 17-11
        public static string permission = "";
        public static string nameUser = "";

        //18-11
        public static string studentInClass = "sp_GetStudentInClass";
        public static SqlParameter[] StudentInClass(string classID)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", classID) };
            return arr;
        }

        public static string allClassID = "sp_GetAllClassID";

        // 22-11
        public static string allClassIdByTeacher = "sp_GetAllClassIdByTeacher";
        public static SqlParameter[] AllClassIdByTeacher(string teacherID)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID) };
            return arr;
        }
        public static string userID = "";

        //25-11
        public static string teacherAvatar = "sp_InsertTeacherAvatar";
        public static SqlParameter[] TeacherAvatar(string teacherID, byte[] imageByte)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID), new SqlParameter("@image", imageByte) };
            return arr;
        }
        public static string getTeacherAvatar = "sp_GetTeacherAvatar";
        public static SqlParameter[] GetTeacherAvatar(string teacherID)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID) };
            return arr;
        }
        public static string getAllTeacher = "sp_GetAllTeacher";
        //26-11
        public static string deleteTeacher = "sp_DeleteTeacher";
        public static SqlParameter[] DeleteTeacher(string teacherID)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID) };
            return arr;
        }
        public static string insertTeacher = "sp_InsertTeacher";
        public static SqlParameter[] InsertTeacher(Teacher t)
        {
            SqlParameter[] arr = { 
                                     new SqlParameter("@teacherID",t.TeacherID),
                                     new SqlParameter("@password",t.Password),
                                     new SqlParameter("@name",t.Name),
                                     new SqlParameter("@gender",t.Gender),
                                     new SqlParameter("@dob",t.Dob),
                                     new SqlParameter("@address",t.Address),
                                     new SqlParameter("@email",t.Email),
                                     new SqlParameter("@phone",t.Phone),
                                     new SqlParameter("@description",t.Description)                                 
                                 };
            return arr;
        }
        public static string updateTeacher = "sp_UpdateTeacher";
        public static SqlParameter[] UpdateTeacher(Teacher t)
        {
            SqlParameter[] arr = { 
                                     new SqlParameter("@teacherID",t.TeacherID),
                                     new SqlParameter("@password",t.Password),
                                     new SqlParameter("@name",t.Name),
                                     new SqlParameter("@gender",t.Gender),
                                     new SqlParameter("@dob",t.Dob),
                                     new SqlParameter("@address",t.Address),
                                     new SqlParameter("@email",t.Email),
                                     new SqlParameter("@phone",t.Phone),
                                     new SqlParameter("@description",t.Description)                                 
                                 };
            return arr;
        }
        public static string getAllSem = "sp_GetAllSem";
        public static string getSubject = "sp_GetSubject";
        public static SqlParameter[] GetSubject(string sem)
        {
            SqlParameter[] arr = { new SqlParameter("@sem", sem) };
            return arr;
        }
        // 27-11
        public static string getTeacherIDAvatar = "sp_GetTeacherIDAvatar";
        public static SqlParameter[] GetTeacherIDAvatar(string teacherID)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID) };
            return arr;
        }
        public static string updateTeacherAvatar = "sp_UpdateTeacherAvatar";
        public static SqlParameter[] UpdateTeacherAvatar(string teacherID, byte[] image)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID), new SqlParameter("@avatar", image) };
            return arr;
        }
        public static string deleteTeacherAvatar = "sp_DeleteTeacherAvatar";
        public static SqlParameter[] DeleteTeacherAvatar(string teacherID)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID) };
            return arr;
        }
        public static string getAllClass = "sp_GetAllClass";
        // 28-11
        public static string getClassHistoryByTeacherID = "sp_GetClassHistoryByTeacherID";
        public static SqlParameter[] GetClassHistoryByTeacherID(string teacherID)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherID", teacherID) };
            return arr;
        }
        public static string searchTeacherByName = "sp_SearchTeacherByName";
        public static SqlParameter[] SearchTeacherByName(string name)
        {
            SqlParameter[] arr = { new SqlParameter("@teacherName", name) };
            return arr;
        }
        //29-11
        public static string getClassInformation = "sp_GetClassInformation";
        public static string getClassIDLearning = "sp_GetClassIDLearning";
        public static string getClassIDWaiting = "sp_GetClassIDWaiting";
        public static string getClassIDFinished = "sp_GetClassIDFinished";
        public static string getClassHistoryByClassID = "sp_GetClassHistoryByClassID";
        public static SqlParameter[] GetClassHistoryByClassID(string classID)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", classID) };
            return arr;
        }
        public static string getClassTimeStartAndTimeEnd = "sp_GetClassTimeStartAndTimeEnd";
        public static SqlParameter[] GetClassTimeStartAndTimeEnd(string classID)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", classID) };
            return arr;
        }
        public static string getClassDetailStudent = "sp_GetClassDetailStudent";
        public static SqlParameter[] GetClassDetailStudent(string classID)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", classID) };
            return arr;
        }

        public static string getClassByClassID = "sp_GetClassByClassID";
        public static SqlParameter[] GetClassByClassID(string classID)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", classID) };
            return arr;
        }
        public static string getAllTeacherID = "sp_GetAllTeacherID";
        public static string getAllStudent = "sp_GetAllStudent";
        public static string getTotalSessionBySubject = "sp_GetTotalSessionBySubjecName";
        public static SqlParameter[] GetTotalSessionBySubject(string subjectName)
        {
            SqlParameter[] arr = { new SqlParameter("@subjectName", subjectName) };
            return arr;
        }

        public static string insertAttendance = "sp_InsertAttendance";
        public static SqlParameter[] InsertAttendance(Attendance a, AttendanceDetail ad)
        {
            SqlParameter[] arr = {new SqlParameter("@attendanceDetailID",ad.AttendanceDetailID),
                                  new SqlParameter("@attendanceID",a.AttendanceID),
                                  new SqlParameter("@subjectID",ad.SubjectID),
                                  new SqlParameter("@classID",a.ClassID),
                                  new SqlParameter("@studentID",ad.StudentID),
                                  new SqlParameter("@timeAttendance",a.TimeAttendance),
                                  new SqlParameter("@sessionCount",ad.SessionCount),
                                  new SqlParameter("@status",ad.Status)};
            return arr;
        }
        public static string insertClass = "sp_InsertClass";
        public static SqlParameter[] InsertClass(Class c)
        {
            SqlParameter[] arr = { new SqlParameter("@classID",c.ClassID),
                                     new SqlParameter("@teacherID",c.TeacherID),
                                     new SqlParameter("@className",c.Name),
                                     new SqlParameter("@timeStart",c.TimeStart),
                                     new SqlParameter("@timeEnd",c.TimeEnd),
                                     new SqlParameter("@timeSlot",c.TimeSlot),
                                     new SqlParameter("@room",c.Room)
                                 };
            return arr;
        }
        public static string updateClass = "sp_UpdateClass";
        public static SqlParameter[] UpdateClass(Class c)
        {
            SqlParameter[] arr = { new SqlParameter("@classID",c.ClassID),                                     
                                     new SqlParameter("@className",c.Name),
                                     new SqlParameter("@timeStart",c.TimeStart),
                                     new SqlParameter("@timeEnd",c.TimeEnd),
                                     new SqlParameter("@timeSlot",c.TimeSlot),
                                     new SqlParameter("@room",c.Room)
                                 };
            return arr;
        }
        public static string updateClassNewTeacher = "sp_UpdateClassNewTeacher";
        public static SqlParameter[] UpdateClassNewTeacher(Class c, DateTime timeLine)
        {
            SqlParameter[] arr = { new SqlParameter("@newTeacherID", c.TeacherID), 
                                     new SqlParameter("@classID",c.ClassID), 
                                     new SqlParameter("@timeLine",timeLine) };
            return arr;
        }
        public static string updateClassHistoryNewTeacher = "sp_UpdateClassHistoryNewTeacher";
        public static SqlParameter[] UpdateClassHistoryNewTeacher(ClassHistory c)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", c.ClassID), 
                                     new SqlParameter("@currentTeacherID",c.TeacherID), 
                                     new SqlParameter("@timeLine",c.TeachTimeEnd)};
            return arr;
        }
        public static string insertClassHistoryNewTeacher = "sp_InsertClassHistoryNewTeacher";
        public static SqlParameter[] InsertClassHistoryNewTeacher(ClassHistory c)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", c.ClassID), 
                                     new SqlParameter("@newTeacherID",c.TeacherID), 
                                     new SqlParameter("@timeLine",c.TeachTimeStart)};
            return arr;
        }
        public static string insertClassHistory = "sp_InsertClassHistory";
        public static SqlParameter[] InsertClassHistory(ClassHistory c)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", c.ClassID), 
                                     new SqlParameter("@teacherID",c.TeacherID), 
                                     new SqlParameter("@timeStart",c.TeachTimeStart)};
            return arr;
        }
        public static string searchClassByClassID = "sp_SearchClassByClassID";
        public static SqlParameter[] SearchClassByClassID(string classID)
        {
            SqlParameter[] arr = { new SqlParameter("@classID", classID) };
            return arr;
        }

        public static string getAttendanceByID = "sp_GetAttendanceByID";
        public static SqlParameter[] GetAttendanceByID(string classID, string attendanceID)
        {
            SqlParameter[] arr = {new SqlParameter("@classID", classID),
                                 new SqlParameter("@attendanceID", attendanceID)};
            return arr;
        }
        public static string getStudentInFormation = "sp_GetStudentInFormation";
        public static SqlParameter[] GetStudentInFormation(string studentID)
        {
            SqlParameter[] arr = { new SqlParameter("@studentID", studentID) };
            return arr;
        }
        public static string getAllStudentByStatus = "sp_GetAllStudentByStatus";
        public static SqlParameter[] GetAllStudentByStatus(string status) {
            SqlParameter[] arr = { new SqlParameter("@status", status) };
            return arr;
        }
        public static string getAllStudentInDB = "sp_GetAllStudentInDB";

        public static string insertStudent = "sp_InsertStudent";
        public static SqlParameter[] InsertStudent(Student s) {
            SqlParameter[] arr = { new SqlParameter("@studentID",s.StudentID),
                                   new SqlParameter("@name",s.Name),
                                   new SqlParameter("@gender",s.Gender),
                                   new SqlParameter("@dob",s.Dob),
                                   new SqlParameter("@address",s.Address),
                                   new SqlParameter("@email",s.Email),
                                   new SqlParameter("@phone",s.Phone)                                   
                                };
            return arr;
        }
        public static string updateStudent= "sp_UpdateStudent";
        public static SqlParameter[] UpdateStudent(Student s)
        {
            SqlParameter[] arr = { new SqlParameter("@studentID",s.StudentID),
                                   new SqlParameter("@name",s.Name),
                                   new SqlParameter("@gender",s.Gender),
                                   new SqlParameter("@dob",s.Dob),
                                   new SqlParameter("@address",s.Address),
                                   new SqlParameter("@email",s.Email),
                                   new SqlParameter("@phone",s.Phone)                                   
                                };
            return arr;
        }
        public static string deleteStudent = "sp_DeleteStudent";
        public static SqlParameter[] DeleteStudent(string studentID)
        {
            SqlParameter[] arr = { new SqlParameter("@studentID",studentID)};
            return arr;
        }
        public static string searchStudent = "sp_SearchStudent";
        public static SqlParameter[] SearchStudent(string name)
        {
            SqlParameter[] arr = { new SqlParameter("@name", name) };
            return arr;
        }
    }

}
